package cn.edu.zjx2.controller;

import cn.edu.mp.service.ClassService;
import cn.edu.mp.service.GradeService;
import cn.edu.mp.service.MajorService;
import cn.edu.mp.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class IndexController {
    
    @Autowired
    private StudentService studentService;
    @Autowired
    private ClassService classService;
    @Autowired
    private GradeService gradeService;
    @Autowired
    private MajorService majorService;

    @GetMapping("/")
    public String index(Model model) {
        model.addAttribute("students", studentService.list());
        model.addAttribute("classes", classService.list());
        model.addAttribute("grades", gradeService.list());
        model.addAttribute("majors", majorService.list());
        return "index";
    }
} 